% Overleaf botch. Normally we use minted files in the build folder, but Overleaf needs special care.
\def\StripPrefix#1>{}
\def\isOverleaf{\fi
    \def\overleafJobname{output}% overleaf defaults to 'output' as \jobname
    \edef\overleafJobname{\expandafter\StripPrefix\meaning\overleafJobname}%
    \edef\job{\jobname}%
    \ifx\job\overleafJobname
}

\if\isOverleaf%
\usepackage[newfloat=true]{minted}
\else
\usepackage[newfloat=true,cachedir=mint,outputdir=build]{minted}
\fi

\usepackage[]{xcolor}
\usemintedstyle{xcode}
\renewcommand\theFancyVerbLine{\footnotesize\arabic{FancyVerbLine}}

\newmintedfile[cppfile]{cpp}{
    linenos=true,
    firstnumber=1,
    tabsize=4,
    obeytabs,
    xleftmargin=1em,
    breaklines,
    fontsize=\footnotesize,
    numbersep=0.75em
}

\newmintinline[cpp]{cpp}{}